import os
# 定义项目根目录
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
    # 从系统环境变量读取活使用后面的字符串
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'sdF#8jjng#$@657TERFCFRTYV%Yv644T@#$@#$CRdCTG2222WEDxFERG%YV%jk334EWCxdfCRG'
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    @staticmethod
    def init_app(app):
        pass
# 开发环境配置项
class DevelopmentConfig(Config):
    # DEBUG 追踪网站信息，建议在开发环境开启
    DEBUG = True
    # SQLALCHEMY连接sqlite数据库
    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'instance/flask.db')
# 生产环境配置项
class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'instance/flask.db')
# config字典注册不同配置环境，默认为开发环境DevelopmentConfig
config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig,
    'default': DevelopmentConfig,
}